package com.lzq.mq.common.enums;

/**
 * broker集群模式枚举
 */
public enum BrokerClusterModeEnum {

    MASTER_SLAVE("master-slave"),
    SINGLE("single")
    ;

    private String code;

    BrokerClusterModeEnum(String code) {
        this.code = code;
    }

    /**
     * 判断当前broker集群模式是否存在
     * @return
     */
    public static boolean exist(String modeCode) {
        for (BrokerClusterModeEnum brokerClusterModeEnum : BrokerClusterModeEnum.values()) {
            if (brokerClusterModeEnum.code.equals(modeCode)) {
                return true;
            }
        }
        return false;
    }

    public String getCode() {
        return code;
    }
}
